Static plot example:
library(ggplot2)
p <- ggplot(mtcars, aes(wt, qsec, color = factor(am))) + geom_point()
p
Plotly:
library(plotly)
##
## Kapcsolódás csomaghoz: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
ggplotly(p)
GGirafe:
library(ggiraph)
library(ggthemr)
ggthemr('pale', layout = 'scientific', spacing = 2, type = 'inner')
p <- ggplot(mtcars, aes(wt, qsec, color = factor(am), tooltip = rownames(mtcars))) + geom_point_interactive()
girafe(ggobj = p)
## Warning: The `scale_name` argument of `discrete_scale()` is deprecated as of ggplot2
## 3.5.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Interactive inputs:
library(shiny)
sliderInput('minhp', "Minimum horsepower", min = 0, max = max(mtcars$hp), value = 100)
renderPlot({
ggplot(subset(mtcars, hp > input$minhp), aes(wt, qsec, color = factor(am))) + geom_point()
})